package com.cac.demo.newCode.digitalTwin.controller;

import com.cac.demo.newCode.materialStorage.service.IMsSslShelvesService;
import com.cac.demo.newCode.sorting.service.IMsGkLogService;
import com.cac.demo.util.adapter.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/digitalTwin")
@Api(tags = "数字孪生")
public class DigitalTwinController {
    @Resource
    private IMsSslShelvesService iMsSslShelvesService;
    @Resource
    private IMsGkLogService iMsGkLogService;

    @PostMapping("/getShelvesPage")
    @ApiOperation(value = "查看缓存箱或托盘货位信息")
    public ResponseMsg<Object> getReturnOrderData() {
        return iMsSslShelvesService.getShelvesList();
    }

    @PostMapping("/getShelvesUtilizationRate")
    @ApiOperation(value = "查看货位利用率")
    public ResponseMsg<Object> getShelvesUtilizationRate() {
        return iMsSslShelvesService.getShelvesUtilizationRate();
    }

    @PostMapping("/getStoreDay")
    @ApiOperation(value = "日入库量")
    public ResponseMsg<Object> getStoreDay() {
        return iMsGkLogService.getStoreDay();
    }
    @PostMapping("/getOutboundDay")
    @ApiOperation(value = "日出库量")
    public ResponseMsg<Object> getOutboundDay() {
        return iMsGkLogService.getOutboundDay();
    }

    @PostMapping("/getMsSslShelves")
    @ApiOperation(value = "获取料箱在库位的位置")
    public ResponseMsg<Object> getMsSslShelves() {
        return iMsSslShelvesService.getMsSslShelves();
    }
    @PostMapping("/getTaskLogs")
    @ApiOperation(value = "获取任务编号和料箱的关联信息")
    public ResponseMsg<Object> getTaskLogs() {
        return iMsSslShelvesService.getTaskLogs();
    }
    @PostMapping("/getMaterialInfoByWorkbinCode")
    @ApiOperation(value = "根据料箱的编码查询物料信息")
    public ResponseMsg<Object> getMaterialInfoByWorkbinCode(@RequestBody String boxCode) {
        return iMsSslShelvesService.getMaterialInfoByWorkbinCode(boxCode);
    }
    @PostMapping("/sendTaskInfo")
    @ApiOperation(value = "持续推送新增的任务号和料箱的关联信息")
    public ResponseMsg<Object> sendTaskInfo(@RequestBody String message) {
        return iMsSslShelvesService.sendTaskInfo(message);
    }
}
